package com.wing.order.controller;

import com.wing.web.excel.DownExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 *
 * @author
 */
@Validated
@Api(value = "Admin-提货订单管理", tags = "#/order/dayTakeGoods2")
@RestController("TakeGoodsProductController")
@RequestMapping("order/admin/dayTakeGoods")
@RequiredArgsConstructor
@Slf4j
public class TakeGoodsProductController {

    @ApiOperation(value = "下载产品数据录入excel模板")
    @GetMapping("/template")
    public void template(HttpServletResponse response, HttpServletRequest request) throws IOException {
        String[] headerArr = {"行标签","物料简码","组件描述","plantCode","采购组织","工厂名称","生产线",
                "采购组描述","供应商回复","供应商","合计","在制","月份","日期","提货数","备注"};
        List<String[]> downData = new ArrayList<>();
        DownExcelUtil.createExcelTemplate(response, request, "日排计划-邮件格式导入模板", Arrays.asList(headerArr),downData, null);
    }





    /**
     * 下载产品数据录入excel模板
     */
    @ApiOperation(value = "下载产品数据录入excel模板")
    @GetMapping("/template2")
    public void template2(HttpServletResponse response, HttpServletRequest request) throws IOException {
        String[] headerArr = {"PlantCode","工厂名称","物料编码","物料描述","采购组织","采购组名称","物料单位",
                "物料类型","计划接收时间","供应商编码","VendorName","三方仓库存","近三个月平均到货","月份","预测需求数"};
        List<String[]> downData = new ArrayList<>();
        DownExcelUtil.createExcelTemplate(response, request, "需求计划导入模板", Arrays.asList(headerArr),downData, null);
    }




}
